from typing import List


# T2
def target_sum(nums: List[int], target: int) -> List[int]:
    rest_dic = {}
    for i in range(len(nums)):
        if nums[i] in rest_dic:
            return [rest_dic[nums[i]], i]
        else:
            rest_dic[target-nums[i]] = i
    return [-1, -1]


if __name__ == '__main__':
    t = [1, 2, 3, 4]
    print(target_sum(t, 5))
